<template>
  <div class="home">
    <p>hello world</p>
    <button @click="handleClick">detail</button>
    <!-- 4.使用组件 -->
    <Head></Head>
  </div>
</template>

<script>
/* 2.引入组件 */
import Head from "../components/head";
import axios from "axios-jsonp-pro"
export default {
  name: "Home",
  methods: {
    handleClick(){
      /* 传id */
      this.$router.push('/about/' + 10);
    }
  },
  /* 3.注册组件 */
  components:{
    Head
  },
  created(){
    // var url = "https://www.easy-mock.com/mock/5c17619055d50372367852db/name/mock";
     var url = "http://api.douban.com/v2/movie/top250";
    axios.jsonp(url).then(res=>{
      console.log(res)
    }) 
    // axios.get(url).then(res=>{
    //   console.log(res)
    // })
  }
};
</script>  

<style lang="scss" scoped>
// scoped自动隔离
.home{
  text-align: center;
  color: red
}
</style>

